package daohang;



import gouwu.webview1;

import com.example.driftwindow.MainActivity;
import com.example.driftwindow.R;



import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebView;
import android.widget.Button;




@SuppressLint("SetJavaScriptEnabled") public class daohangMainActivity extends Activity {

	public static WebView webview=null;
	Button  bt=null;
	Button bs=null;
	webview1 ve=new webview1();
	
	@Override

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.email);

		

			webview =(WebView) super.findViewById(R.id.webView1);
			webview.getSettings().setJavaScriptEnabled(true);
	        webview.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);

			webview.getSettings().setSupportZoom(true);
			webview.getSettings().setLoadWithOverviewMode(true);
			webview.getSettings().setBuiltInZoomControls(true);
		
	        
	    	webview.loadUrl("http://www.dengluyi.com/bjzhuyephone.htm");
		    
            webview.setWebViewClient(new webview1(){
            	
                public boolean shouldOverrideUrlLoading(WebView view, String url) {
                	if(url.indexOf("dengluyi")==-1){
                		Uri uri = Uri
                				.parse(url);
                		Intent it = new Intent(Intent.ACTION_VIEW, uri);
                		daohangMainActivity.this.startActivity(it);
                		return true;
                	}else{
                    view.loadUrl(url);
                    return true;
                	}
                	
                	}
            
            	
            });
}
	
	

			public boolean onKeyDown(int keyCode,KeyEvent event){
				if((keyCode==KeyEvent.KEYCODE_BACK)&& webview.canGoBack()){
					webview.goBack();
					return true;
				}
					Intent intent=new Intent();
					intent.setClass(daohangMainActivity.this,MainActivity.class);
     			    startActivity(intent);
				    finish();
				    return true;
				
//				return onKeyDown(keyCode, event);
				
				}

	
 
		

	}
